# -*- coding: UTF-8 -*-
"""
@author: tgy
@file: func_call_stack.py
@time: 2021/02/05
"""


class decorator:
    ...

    def __init__(self, func):
        self.count = 0
        self.func = func

    def __call__(self, *args, **kwargs):
        self.count += 1;
        print('call count {},func name:{}'.format(self.count, self.func.__name__))
        return self.func(*args, **kwargs)


def decorator(func):
    count = 0
    def call(*args, **kwargs):
        nonlocal count
        count += 1
        print('call count {},func name:{}'.format(count, func.__name__))
        return func(*args, **kwargs)

    return call


def decorator(func):

    def call(*args, **kwargs):

        call.count += 1
        print('call count {},func name:{}'.format(call.count, func.__name__))
        return func(*args, **kwargs)
    call.count = 0
    return call



@decorator
def run(a, b, c):
    return a + b + c


@decorator
def take(a,b):
    return a * b

if __name__ == '__main__':
    pass
    print(run(1, 2, 3))
    print(run(1, 2, 3))
    print(run(1, 2, 3))
    print(run(1, 2, 3))
    print(take(1, 2))
